<template>
    <div class="new-info">
        <h3 class="title">{{getInfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间{{getInfo.add_time|timef}}</span>
            <span>点击：{{getInfo.click}}次</span>
        </p>
        <hr>
        <div class="content" v-html='getInfo.content'></div>
        <comment-box :id='id'></comment-box>
    </div>
</template>
<script>
import comment from '../subcomponents/comment.vue'
export default {
    data(){
        return {
            id:this.$route.params.id,
            getInfo:[]
        }
    },
    created() {
        this.getNewsInfo()
    },
    methods: {
        getNewsInfo(){
            this.$http.get('api/getnew/'+this.id).then(function(res){
                // console.log(res.body.message);
                if(status==0){
                    this.getInfo=res.body.message[0];
                    console.log(this.getInfo)
                }
            })
        }
        
    },
    //注册子组件
    components:{
        "comment-box":comment
    },
};
</script>
<style lang='scss'>
.new-info{
    padding: 0 4px;
    .title{
        text-align: center;
    }
    .subtitle{
        display: flex;
        justify-content: space-between;
    }
    .content{
        color: rgb(75, 72, 72);
        font-size: 16px;
    }
}
    
</style>

